package com.boulderai.mcp.model.llm;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

/**
 * 大模型消息模型
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class LlmMessage {
    
    @JsonProperty("role")
    private String role; // "system", "user", "assistant", "tool"
    
    @JsonProperty("content")
    private String content;
    
    @JsonProperty("name")
    private String name; // 用于function/tool调用时的名称
    
    @JsonProperty("tool_calls")
    private List<LlmToolCall> toolCalls;
    
    @JsonProperty("tool_call_id")
    private String toolCallId; // 用于tool响应消息
    
    public LlmMessage() {}
    
    public LlmMessage(String role, String content) {
        this.role = role;
        this.content = content;
    }
    
    public LlmMessage(String role, String content, String name) {
        this.role = role;
        this.content = content;
        this.name = name;
    }
    
    // 静态工厂方法
    public static LlmMessage systemMessage(String content) {
        return new LlmMessage("system", content);
    }
    
    public static LlmMessage userMessage(String content) {
        return new LlmMessage("user", content);
    }
    
    public static LlmMessage assistantMessage(String content) {
        return new LlmMessage("assistant", content);
    }
    
    public static LlmMessage toolMessage(String content, String toolCallId) {
        LlmMessage message = new LlmMessage("tool", content);
        message.setToolCallId(toolCallId);
        return message;
    }
    
    // Getters and Setters
    public String getRole() {
        return role;
    }
    
    public void setRole(String role) {
        this.role = role;
    }
    
    public String getContent() {
        return content;
    }
    
    public void setContent(String content) {
        this.content = content;
    }
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public List<LlmToolCall> getToolCalls() {
        return toolCalls;
    }
    
    public void setToolCalls(List<LlmToolCall> toolCalls) {
        this.toolCalls = toolCalls;
    }
    
    public String getToolCallId() {
        return toolCallId;
    }
    
    public void setToolCallId(String toolCallId) {
        this.toolCallId = toolCallId;
    }
}